package acm.蓝桥18;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Scanner;

public class D劈我瓜是吧 {
    /**
     * dp[i][j]:i个西瓜，坎成总数为j的方案
     */
    static long[] gua;
    static int n, m;
    static final int tag = Integer.MAX_VALUE;
    public static int dfs(int i, long m) {
        if (m == 0) {
            return 0;
        }
        if (i == 0) {
            return tag;
        }
        int pg = dfs(i - 1, m - gua[i - 1]);   //选当前挂
        int bp = dfs(i - 1, m);
        int chose = dfs(i - 1, m - gua[i - 1] * 2);
        int res = Math.min(bp, chose);
        if (pg != tag) {
            res = Math.min(pg + 1, res);
        }
        return res;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        m = sc.nextInt() * 2;
        gua = new long[n];
        for (int i = 0; i < gua.length; i++) {
            gua[i] = sc.nextInt();
        }
        int dfs = dfs(n, m);
        System.out.println(dfs);
    }
}
